
import socket

if __name__ == "__main__":
    socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  # 创建socket对象
    socket.connect(('127.0.0.1', 9999))  # 连接服务端的端口9999
    message = ""
    # 收到服务端发送的数据
    data = socket.recv(1024).decode('utf-8')
    if data:
        message += data
    print(f"收到服务端发送的数据为：{message}")
    result = input("请输入你想要发送给客户端的数据：\n")
    socket.send(result.encode('utf-8'))
    socket.close()

